Public Class clsEvent

    Sub TestEvent()
        '
        ' Create the ObjUtilsUtilsUtilsect that raises the event you want to handle.
        '
        Dim myObj As New ObjUtils()
        '
        ' Associate the code to be executed (event handler) with the event.
        '
        AddHandler myObj.MyEvent, AddressOf MyEventHandler
        '
        ' Tell the ObjUtilsUtilsUtilsect to raise the event. It will be handled by sub MyEventHandler.
        '
        myObj.RaiseMyEvent()
        '
        ' Dis-associate the handler from the event.
        '
        RemoveHandler myObj.MyEvent, AddressOf MyEventHandler
        '
        ' Tell the ObjUtilsUtilsUtilsect to raise the event. It will NOT be handled by sub MyEventHandler.
        '
        myObj.RaiseMyEvent()
    End Sub

    Sub MyEventHandler()
        '
        ' Code to be executed when the event is raised.
        '
        MsgBox("I caught the event!")
    End Sub
End Class

